<%--
  Created by IntelliJ IDEA.
  User: 26355
  Date: 2019/1/23
  Time: 17:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>积分兑换</title>
    <link rel="stylesheet" href="/layui-2.4/layui-v2.4.5/layui/css/layui.css">
    <script src="/layui-2.4/layui-v2.4.5/layui/layui.js" charset="utf-8"></script>

</head>
<body>
用户积分<%=application.getAttribute("integral")%>
<table class="layui-hide" id="test" lay-filter="test"></table>
<script id="barDemo" type="text/html">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="reduce">兑换</a>
</script>
<script>

    layui.use('table', function(){
        var table = layui.table;

        table.render({
            elem: '#test'
            ,url:'/integral'
            ,cols: [[
               {field:'goodName', width:800, title: '商品', sort: false}
                ,{field:'pointId', width:150, title: '积分', sort: true}
                ,{fixed: 'right', title:'积分兑换', toolbar: '#barDemo', width:150}

            ]]
            ,page: true
            ,limits:[3,5,10]
        });
        table.on('tool(test)', function(obj){
            var data = obj.data;
            if(obj.event === 'reduce'){
                var pointId=data.pointId;
                window.location.href="/integral?operate=reduce&pointId="+pointId;

            }
        })
    });

</script>
</body>

</html>
